/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MD5;
import java.io.*;
import javax.crypto.*;
import java.security.*;
import java.math.BigInteger;
/**
 *
 * @author Trung
 */
public class MD5 {
     public static String maHoa(String text){
        String passMaHoa=null;
        try{
            MessageDigest md5=MessageDigest.getInstance("MD5");
            md5.update(text.getBytes());
            BigInteger dis=new BigInteger(1,md5.digest());
            text=dis.toString(16);
            passMaHoa=text;
            
        }catch(NoSuchAlgorithmException e){
            System.out.print("Loi Khong ma hoa dc");
        }
        return passMaHoa;
    }
  
}
